import * as express from 'express';
import {Request, Response, Router} from 'express';
import * as testController from './controllers/test';
import {Server} from 'typescript-rest';
import controllers from "./controllers/bundle";

class Application {
    public router: Router;

    constructor() {
        this.router = express.Router();
        this.route();
        this.buildRest();
    }

    private route() {
        this.router.get('/', (req: Request, res, Response) => {
            res.send('Test message for calling success.');
        });
        this.router.get('/test', testController.testFunc);
    }

    private buildRest() {
        Server.buildServices(this.router, ...controllers);
    }
}

export = new Application().router;